 {

        var o = require("./UISoundManager.js"), i = require("./UIPopupBase.js");
        cc.Class({
            extends: i,
            properties: {
                shopSelectItem: {
                    default: null,
                    type: cc.Prefab
                },
                layoutContent: {
                    default: null,
                    type: cc.Layout
                },
                btnDiamondBg: {
                    default: null,
                    type: cc.Sprite
                },
                btnGoldBg: {
                    default: null,
                    type: cc.Sprite
                },
                labCoin: {
                    default: null,
                    type: cc.Label
                },
                labDiamond: {
                    default: null,
                    type: cc.Label
                },
                _type: null
            },
            init: function () {
            },
            onLoad: function () {
                Global.notificationCenter.on(Global.eventName.MSG_STORE, this.showStoreData.bind(this), this),
                    this.shopItemPool = new cc.NodePool();
                for (var e = 0; e < 10; ++e) {
                    var t = cc.instantiate(this.shopSelectItem);
                    this.shopItemPool.put(t);
                }
                this.list = Global.configCdn.getShopIdsConf() || Global.configCdn.getDefaultConfig("shopIds");
            },
            start: function () {
                var e = Global.userProfile;
                if (this.labCoin && e && e.getUserProfile() && (this.labCoin.string = Global.utils.exchangeToWan(e.getUserProfile().chip)),
                this.labDiamond && e && e.getUserProfile() && (this.labDiamond.string = e.getHadYuanBaoNum()),
                cc.sys.platform == cc.sys.WECHAT_GAME) {
                    var t = Global.utils.searchComp(this.node, "shopLayout", cc.Widget);
                    if (t) {
                        var n = Global.utils.getOffsetByPhoneType();
                        t.right = n;
                    }
                }
            },
            update: function (e) {
                var t = Global.userProfile, n = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN), o = void 0,
                    i = void 0;
                if (this.labCoin && (o = this.labCoin.node.parent), this.labDiamond && (i = this.labDiamond.node.parent),
                o && (o.active = !0, t && t.getUserProfile())) {
                    var a = t.getUserProfile().chip;
                    Global.tableModel.getIsGameStart() && n && n.getTableCoin() && (a = n.getTableCoin()),
                        this.labCoin.string = Global.utils.exchangeToWan(a);
                }
                i && (i.active = !0, t && t.getUserProfile() && (this.labDiamond.string = t.getHadYuanBaoNum()));
            },
            showStoreData: function (e) {
                if (this._diamondList = [], this._coinList = [], e && e.result) {
                    var t = e.result;
                    if ("ui" == t.action) {
                        for (var n = 0; n < t.tabs.length; n++) {
                            var o = t.tabs[n];
                            if (o.name == Global.config.shopType.DIAMOND) {
                                for (var i in this.list) for (var a = 0; a < o.items.length; a++) if (o.items[a] == i) {
                                    this._diamondList.push(this.list[i]);
                                    break;
                                }
                            } else if (o.name == Global.config.shopType.COIN) for (var r in this.list) for (a = 0; a < o.items.length; a++) if (o.items[a] == r) {
                                this._coinList.push(this.list[r]);
                                break;
                            }
                        }
                        this.createPriceItem();
                    }
                }
            },
            selectType: function (e) {
                this._type = e, Global.msgHandler.requestShopList();
            },
            createPriceItem: function () {
                console.log("createPriceItem", this._coinList, this._diamondList), null == this._type && (this._type = Global.config.shopType.COIN);
                var e = function (e, t) {
                    var n = parseInt(e.displayName), o = parseInt(t.displayName);
                    return n < o ? -1 : n > o ? 1 : 0;
                };
                this._coinList = this._coinList.sort(e), this._diamondList = this._diamondList.sort(e);
                var t = this._type == Global.config.shopType.COIN ? this._coinList : this._diamondList, n = t.length;
                if (this._type == Global.config.shopType.DIAMOND && 0 == n && Global.utils.showNodeCommon("钻石已被抢购一空，您先买金币，买金币也很优惠的。", 3),
                this.layoutContent.node.childrenCount < n) for (var o = n - this.layoutContent.node.childrenCount, i = 0; i < o; i++) {
                    var a = this.getItem();
                    this.layoutContent.node.addChild(a);
                } else for (var r = this.layoutContent.node.childrenCount - 1; r >= n; r--) {
                    var s = this.layoutContent.node.children[r];
                    this.returnItem(s);
                }
                var l = 0;
                for (r = 0; r < n; r++) {
                    this.layoutContent.node.children[r].getComponent("ShopSelectItem").bindData(t[l]),
                        l++;
                }
                this._type == Global.config.shopType.COIN ? (Global.spriteAtlas.setSpriteFrame(this.btnDiamondBg, "Texture/shop", "qiehuanBJ"),
                    Global.spriteAtlas.setSpriteFrame(this.btnGoldBg, "Texture/shop", "xuanzhongBJ")) : this._type == Global.config.shopType.DIAMOND && (Global.spriteAtlas.setSpriteFrame(this.btnDiamondBg, "Texture/shop", "xuanzhongBJ"),
                    Global.spriteAtlas.setSpriteFrame(this.btnGoldBg, "Texture/shop", "qiehuanBJ")),
                    console.log("createPriceItem", l), l == n && Global.utils.hideWaitting();
            },
            getItem: function () {
                return this.shopItemPool.size() > 0 ? this.shopItemPool.get() : cc.instantiate(this.shopSelectItem);
            },
            onBtnDiamond: function () {
                this._type != Global.config.shopType.DIAMOND && (Global.utils.showWaitting(), o.playEffect("select"),
                    Global.msgHandler.requestShopList(), Global.utils.showNodeCommon("钻石已被抢购一空，您先买金币，买金币也很优惠的。", 3)),
                    this._type = Global.config.shopType.DIAMOND;
            },
            onBtnGold: function () {
                this._type != Global.config.shopType.COIN && (Global.utils.showWaitting(), o.playEffect("select"),
                    Global.msgHandler.requestShopList()), this._type = Global.config.shopType.COIN;
            },
            putNodeIntoPool: function () {
                for (var e = this.layoutContent.node.childrenCount - 1; e >= 0; e--) {
                    var t = this.layoutContent.node.children[e];
                    this.returnItem(t);
                }
            },
            returnItem: function (e) {
                this.shopItemPool.put(e);
            },
            OnPanelClose: function () {
                o.playEffect("select"), this.closePanel();
            }
        })
    }